import { SetMetadata } from '@nestjs/common';

export const PERMISSIONS_KEY = 'permissions';

/**
 * 权限装饰器
 * 指定接口需要的权限
 * 
 * @example
 * @Permissions('user:create', 'user:update')
 * @Post('users')
 * create() {}
 */
export const Permissions = (...permissions: string[]) =>
  SetMetadata(PERMISSIONS_KEY, permissions);

